{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/ardha27/AI-Song-Cover-RVC/blob/main/Hina_Mod_AICoverGen_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "YYVAKuNBc-X4"
      },
      "source": [
        "\n",
        "\n",
        "# AICoverGen WebUI (Modded by [Hina](https://discordlookup.com/user/444684887363026974))\n",
        "\n",
        "Simply click `Runtime` in the top navigation bar and `Run all`. Wait for the output of the final cell to show the public gradio url and click on it."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "vC4gLMHI9xb3",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@title Clone repository\n",
        "from IPython.display import clear_output, Javascript\n",
        "import codecs\n",
        "import threading\n",
        "import time\n",
        "import os\n",
        "# cloneing=codecs.decode('uggcf://tvguho.pbz/uvanoy/NVPbireTra-Pbyno.tvg','rot_13')\n",
        "\n",
        "#=======================Auto Edit======================\n",
        "\n",
        "#@markdown ---\n",
        "#@markdown Switch between ```-1 0 1``` or ```-12 0 12``` pitch change control\n",
        "\n",
        "#@markdown This can only be changed once, you need to restart the whole thing if you wanna change it again\n",
        "Pitch_Change=\"12\" #@param ['1','12']\n",
        "\n",
        "#@markdown Enable if you want to install the Program to your Drive\n",
        "if Pitch_Change==\"1\":\n",
        "  cloneing=codecs.decode('uggcf://tvguho.pbz/FbpvnyylVarcgJrro/NVPbireTra.tvg','rot_13')\n",
        "else:\n",
        "  cloneing=codecs.decode('uggcf://tvguho.pbz/nequn27/NVPbireTra-Zbq.tvg','rot_13')\n",
        "#=====================Auto Edit End================\n",
        "Install_To_Drive=True #@param {type:\"boolean\"}\n",
        "\n",
        "\n",
        "#====================Use Drive============\n",
        "if Install_To_Drive == True:\n",
        "    from google.colab import drive\n",
        "    drive.mount('/content/drive')\n",
        "    repo_path = '/content/drive/MyDrive/Hina_RVC'\n",
        "else:\n",
        "    repo_path = '/content/Hina_RVC'\n",
        "\n",
        "if os.path.isdir(repo_path):\n",
        "    print(f\"Repository already exists at {repo_path}, pulling the latest changes.\")\n",
        "    %cd $repo_path\n",
        "    !git pull\n",
        "else:\n",
        "    print(f\"Cloning repository to {repo_path}\")\n",
        "    !git clone $cloneing Hina_RVC\n",
        "    if Install_To_Drive == True:\n",
        "        !mv Hina_RVC /content/drive/MyDrive/\n",
        "        %cd /content/drive/MyDrive/Hina_RVC\n",
        "    else:\n",
        "        %cd Hina_RVC\n",
        "\n",
        "!rm -rf sample_data\n",
        "\n",
        "\n",
        "def update_timer_and_print():\n",
        "    global timer\n",
        "    while True:\n",
        "        hours, remainder = divmod(timer, 3600)\n",
        "        minutes, seconds = divmod(remainder, 60)\n",
        "        timer_str = f'{hours:02}:{minutes:02}:{seconds:02}'\n",
        "        print(f'\\rTimer: {timer_str}', end='', flush=True)  # Print without a newline\n",
        "        time.sleep(1)\n",
        "        timer += 1\n",
        "timer = 0\n",
        "threading.Thread(target=update_timer_and_print, daemon=True).start()\n",
        "\n",
        "\n",
        "\n",
        "clear_output()\n",
        "print(\"Done Cloning Repository\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "odzpJHpr_PaF"
      },
      "outputs": [],
      "source": [
        "#@title Install requirements\n",
        "!sed -i '/torch==/d' requirements.txt\n",
        "!sed -i '/torchaudio==/d' requirements.txt\n",
        "!sed -i '/numpy==/d' requirements.txt\n",
        "!sed -i '/librosa==/d' requirements.txt\n",
        "!sed -i '/Requests==/d' requirements.txt\n",
        "!sed -i '/scipy==/d' requirements.txt\n",
        "!sed -i '/soundfile==/d' requirements.txt\n",
        "!sed -i '/tqdm==/d' requirements.txt\n",
        "!sed -i '/onnxruntime_gpu/d' requirements.txt\n",
        "\n",
        "!pip install pip==23.3.1\n",
        "!pip install -q -r requirements.txt\n",
        "!pip install -q ort-nightly-gpu --index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple/\n",
        "!pip install fastapi==0.112.2\n",
        "clear_output()\n",
        "print(\"Finished Installing Requirements\")\n",
        "!sudo apt update\n",
        "clear_output()\n",
        "print(\"Finished Updating\")\n",
        "!sudo apt install sox\n",
        "clear_output()\n",
        "print(\"Finsihed running this cell, proceed to the next cell\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "SLWpcJc0AHSZ",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@title Download MDXNet Vocal Separation and Hubert Base Models\n",
        "models=codecs.decode('fep/qbjaybnq_zbqryf.cl','rot_13')\n",
        "!python $models\n",
        "clear_output()\n",
        "print(\"Finished Downloading Voice Separation Model and Hubert Base Model\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "NEglTq6Ya9d0",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@title Run WebUI\n",
        "runpice=codecs.decode('fep/jrohv.cl','rot_13')\n",
        "!python $runpice --share"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "[![](https://i.pinimg.com/474x/de/72/9e/de729ecfa41b69901c42c82fff752414.jpg)](https://discordlookup.com/user/444684887363026974)"
      ],
      "metadata": {
        "id": "npldkPdYfkrA"
      }
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "provenance": [],
      "private_outputs": true,
      "cell_execution_strategy": "setup",
      "include_colab_link": true
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}